package com.android.inputmethod.pinyin;

import java.util.Comparator;

/**
 * Created by Admin on 2018/2/12.
 */

public class Letter{
    String splString;
    String numberSplString;
    String letter;
    public float startPos = 0.0f;
    float freq;
    public Letter(String spl,String le,float freq,String numSpl)
    {
        splString = spl;
        letter = le;
        this.freq = freq;
        numberSplString = numSpl;
    }

    private void convert()
    {
        numberSplString = "";
        for(int i = 0;i<splString.length();i++)
        {
            char c = splString.charAt(i);
            if(c>'z') c -= 'A'-'a';
            switch (c)
            {
                case 'a':
                case 'b':
                case 'c':
                    numberSplString += "a";
                    break;
                case 'd':
                case 'e':
                case 'f':
                    numberSplString += "d";
                    break;
                case 'g':
                case 'h':
                case 'i':
                    numberSplString += "g";
                    break;

                case 'j':
                case 'k':
                case 'l':
                    numberSplString += "j";
                    break;

                case 'm':
                case 'n':
                case 'o':
                    numberSplString += "m";
                    break;

                case 'p':
                case 'q':
                case 'r':
                case 's':
                    numberSplString += "p";
                    break;

                case 't':
                case 'u':
                case 'v':
                    numberSplString += "t";
                    break;
                case 'w':
                case 'x':
                case 'y':
                case 'z':
                    numberSplString += "w";
                    break;
                default:
                    break;
            }
        }
    }

    public String toString()
    {
        return "spell:"+splString+"\tnumSpell:"+numberSplString+"\tletter:"+letter+"\tfreq:"+freq+"\n";
    }


}